<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/common.css" />
		<link rel="stylesheet" type="text/css" href="../css/self-artshow.css"/>
		<link rel="stylesheet" type="text/css" href="../css/state-icons.css"/>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-back mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">我发布的帮办</h1>
		</header>
		<div class="mui-content">
			<ul class="mui-table-view" id="myartshow-list">
				<!--<li class="mui-table-view-cell mui-media">
					<a href="javascript:;">
						<div class="artshowImg mui-media-object mui-pull-left">
							<img src="../images/icon/artshow/daiyan.jpg" />
							<span>2 / 12 人</span>
						</div>
						<div class="mui-media-body">
							<h5 class="artshow-title mui-ellipsis">
								12月10日南城需要主持人
							</h5>
							<p class="artshow-info">
								<span>哈尔滨</span>
								<span>01-22</span> - <span>02-07</span>
							</p>
							<p class="artshow-state">
								<span class="audit-state state1 state-icon">审核中</span>
								<span class="sign-up-state s-state0 state-icon">停止报名</span>
								<span class="mui-pull-right">01-03</span>
							</p>
						</div>
					</a>
				</li>-->
			</ul>
		</div>
		<script src="../js/mui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/user.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var myArtshowList = document.getElementById("myartshow-list");
			mui.plusReady(function() {
				Common.ajax({
					url : baseURL + 'myArtPerf/getSendList/23.json'
				}, function(data) {
					console.log(JSON.stringify(data));
					if(data.state) {
						var data = data.result;
						if(data.length) {
							for(var i = 0; i < data.length; i++) {
								createMyArtPerfList(data[i].id, data[i].title, data[i].type, data[i].city,
									data[i].performBeginTime.substr(0, 16), data[i].performEndTime.substr(0, 16), data[i].auditState,
									data[i].signupState, data[i].numberOfApplicants, data[i].signupNum, data[i].releaseTime.substr(0, 10));
							}
						} else {
							Common.showState(myArtshowList, '&#xe608;', '你还没有发布过帮办', 50);
						}
					} else {
						mui.toast('加载失败');
					}
				}, function(xhr) {
					Common.linkError();
					console.error('failed - ' + xhr.status + ' : ' + xhr.statusText);
				})
			})

			/**
			 * @param {Object} id		演艺id
			 * @param {Object} title	标题
			 * @param {Object} type		类型
			 * @param {Object} city		城市
			 * @param {Object} bTime	开始时间
			 * @param {Object} eTime	结束时间
			 * @param {Object} aState	审核状态
			 * @param {Object} sState	报名状态
			 * @param {Object} aNum		需求人数
			 * @param {Object} sNum		报名人数
			 * @param {Object} rTime	发布时间
			 */
			function createMyArtPerfList(id, title, type, city, bTime, eTime, aState, sState, aNum, sNum, rTime) {
				var item = document.createElement("li");
				item.id = id;
				item.className = 'mui-table-view-cell mui-media';
				var icons = ['yanchanghui', 'yinyuejie', 'jiuba', 'zhuchang', 'canting', 'kaiye',
					'nianhui', 'shengri', 'hunli', 'paishe', 'luzhi', 'xuanchuanpian', 'peixun',
					'juchang', 'huzhu', 'daiyan'
				];
				var str = '<a href="javascript:;"><div class="artshowImg mui-media-object mui-pull-left">';
				str += '<img src="../images/' + (Number.isNaN(Number(type)) ? 'header' : 'icon/artshow/' + icons[Number(type) - 1]) + 　'.jpg" /><span>';
				str += sNum + ' / ' + aNum + ' 人</span></div><div class="mui-media-body">';
				str += '<h5 class="artshow-title mui-ellipsis">' + title + '</h5><p class="artshow-info"><span> ';
				str += city + ' </span><span>' + bTime + '</span> - <span>' + eTime + '</span></p><p class="artshow-state">';
				str += '<span class="audit-state audit-state-' + aState + ' state-icon">' + Common.auditState[aState - 1] + '</span>';
				str += '<span class="sign-up-state sign-up-state-' + sState + ' state-icon"> ' + (sState == 1 ? '报名中' : '停止报名');
				str += '</span><span class="mui-pull-right">' + rTime + '</span></p></div></a>';
				item.innerHTML = str;
				myArtshowList.appendChild(item);
			}

			mui('#myartshow-list').on('tap', '.mui-table-view-cell', function() {
				var id = this.id;
				Common.openWindow('my-artshow-detail.html', {
					artshowId: id
				});
			})
		</script>
	</body>

</html>